﻿
@{
    Layout = null;
}

<!DOCTYPE html>

<html>
<head>
    <meta name="viewport" content="width=device-width" />
    <title>Index</title>
</head>
<body>
    <div> 
        <input  type="button" value="释放资源" width="100px" height="20px" onclick="disconnect()" />
    </div>
    <script src="~/Scripts/jquery-1.10.2.min.js"></script>
    <script src="~/Scripts/jquery.signalR-2.2.2.min.js"></script>
    <script src="~/signalr/hubs"></script>
    <script>
        $(function () {

            var order = $.connection.orderHub;

            order.client.sendOrderNoResult = function (data) {
                console.log(data);
                if (data.state == 1) {
                    window.location.href = "http://www.liaowa365.com/";
                }
            };


            // Start the connection.
            $.connection.hub.start().done(function () {
                //qrcode.server.updateConnectionId($.connection.hub.id);
                //setInterval(function () {
                //    order.server.getOrderNoHandle("wx-3815058876961");
                //}, 3000);
                order.server.getOrderNoHandle("wx-3815058876961");
            });
        });

        function disconnect() {
            alert("成功");

            $.connection.hub.stop();

            //$.connection.hub.disconnected(function () {
            //    console.log('disconnected');
            //    if ($.connection.hub.lastError) {
            //        //accessing lastError in the disconnect event
            //        //if a server error led the client to disconnect, the error information will be passed to the client as $.connection.hub.lastError
            //        console.log("Disconnected. Reason: " + $.connection.hub.lastError.message);
            //    }
            //    if (tryingToReconnect) {
            //        console.log('disconnected but is trying to reconnect');
            //    }
            //});
        }


        //qrcode.server.updateConnectionId($.connection.hub.id);
        //t=setInterval(function () {
        //    console.log(order_no);
        //    order.server.getOrderNoHandle(order_no);
        //}, 3000);

        //清除定时器
        //clearTimeout(t);

        //定时器对象
        //var t;
    </script>
</body>
</html>
